package com.example.kaoshi;

import java.util.Scanner;

/**
 * Created by Quincy on 2018/9/28.
 */
public class TestScanner {

    public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);
        String str;
//        while ((str= scanner.nextLine()).contains(" ")){
//            String[] split = str.split(" ");
//            int key = Integer.parseInt(split[0]);
//            int value = Integer.parseInt(split[1]);
//            System.out.println(key+""+value);
//        }

//        while (scanner.hasNext()){
//            int m = scanner.nextInt();
//            int[] number = new int[m];
//            for (int i = 0; i < m; i++){
//                number[i] = scanner.nextInt();
//            }
//            System.out.println(Arrays.toString(number));
//        }

//        int n = scanner.nextInt();
//        int m = scanner.nextInt();
//        System.out.println(n+""+m);

        /**
         * 输入一个二维矩阵，列长随意
         * */
        int a[][]=new int[100][100];
        int n;
        Scanner in=new Scanner(System.in);
        n=in.nextInt();		//跳过这行换行符
        in.nextLine();
        for(int i=0;i<n;i++){
            String strLine = in.nextLine();
            Scanner s = new Scanner(strLine);
            int j=0;
            while(s.hasNextInt()){
                a[i][j++]=s.nextInt();
            }
        }			//输出
        for( int i=0;i<n;i++){
            int j=0;
            while(a[i][j]!=0)
                System.out.print(a[i][j++]+"  ");
            System.out.println();
        }

    }
}
